package pojo;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;

import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;

/**
 * 
 * @author zgy
 * 
 */
@Repository
public class ZcOrder implements RowMapper<ZcOrder>, Serializable {

	private Integer id;
	private String orderNum;
	private Integer itemSize;
	private Double total;
	private Timestamp createTime;
	private Timestamp endTime;
	private Timestamp payTime;
	private String payStatus;
	private String status;
	private Integer userId;
	private String userMp;
	private String userName;
	private Integer userAreaId;
	private String userArea;
	private String userAddress;
	private String remark;
	
	public ZcOrder() {
		super();
		// TODO Auto-generated constructor stub
	}

	

	public ZcOrder(Integer id, String orderNum, Integer itemSize, Double total,
			Timestamp createTime, Timestamp endTime, Timestamp payTime,
			String payStatus, String status, Integer userId, String userMp,
			String userName, Integer userAreaId, String userArea,
			String userAddress,String remark) {
		super();
		this.id = id;
		this.orderNum = orderNum;
		this.itemSize = itemSize;
		this.total = total;
		this.createTime = createTime;
		this.endTime = endTime;
		this.payTime = payTime;
		this.payStatus = payStatus;
		this.status = status;
		this.userId = userId;
		this.userMp = userMp;
		this.userName = userName;
		this.userAreaId = userAreaId;
		this.userArea = userArea;
		this.userAddress = userAddress;
		this.remark = remark;
	}



	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getOrderNum() {
		return orderNum;
	}

	public void setOrderNum(String orderNum) {
		this.orderNum = orderNum;
	}

	public Integer getItemSize() {
		return itemSize;
	}

	public void setItemSize(Integer itemSize) {
		this.itemSize = itemSize;
	}

	public Double getTotal() {
		return total;
	}

	public void setTotal(Double total) {
		this.total = total;
	}

	public Timestamp getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	public Timestamp getEndTime() {
		return endTime;
	}

	public void setEndTime(Timestamp endTime) {
		this.endTime = endTime;
	}

	public Timestamp getPayTime() {
		return payTime;
	}

	public void setPayTime(Timestamp payTime) {
		this.payTime = payTime;
	}

	public String getPayStatus() {
		return payStatus;
	}

	public void setPayStatus(String payStatus) {
		this.payStatus = payStatus;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getUserMp() {
		return userMp;
	}

	public void setUserMp(String userMp) {
		this.userMp = userMp;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Integer getUserAreaId() {
		return userAreaId;
	}

	public void setUserAreaId(Integer userAreaId) {
		this.userAreaId = userAreaId;
	}

	public String getUserArea() {
		return userArea;
	}

	public void setUserArea(String userArea) {
		this.userArea = userArea;
	}

	public String getUserAddress() {
		return userAddress;
	}

	public void setUserAddress(String userAddress) {
		this.userAddress = userAddress;
	}
	
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}


	@Override
	public ZcOrder mapRow(ResultSet rs, int rowNum) throws SQLException {
		ZcOrder e = new ZcOrder();
		e.setId(rs.getInt("id"));
		e.setOrderNum(rs.getString("order_num"));
		e.setCreateTime(rs.getTimestamp("create_time"));
		e.setEndTime(rs.getTimestamp("end_time"));
		e.setStatus(rs.getString("status"));
		e.setItemSize(rs.getInt("item_size"));
		e.setTotal(rs.getDouble("total"));
		e.setPayStatus(rs.getString("pay_status"));
		e.setUserMp(rs.getString("user_mp"));
		e.setRemark(rs.getString("remark"));
		return e;
	}
	
	public Object[] insertObjecParams(){
		Object[] params = new Object[]{
				orderNum,itemSize,total,
				createTime,userId,userMp,
				userName,userAreaId,userArea,
				userAddress,remark};
		return params;
	}

}
